package io.renren.modules.medicine.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.medicine.dao.TDatasetDao;
import io.renren.modules.medicine.dto.TDatasetDTO;
import io.renren.modules.medicine.entity.TDatasetEntity;
import io.renren.modules.medicine.service.TDatasetService;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 预制数据集
 *
 * @author sheliming shelimingming@qq.com
 * @since 1.0.0 2023-01-13
 */
@Service
public class TDatasetServiceImpl extends CrudServiceImpl<TDatasetDao, TDatasetEntity, TDatasetDTO> implements TDatasetService {

    @Autowired
    private TDatasetDao tDatasetDao;

    @Override
    public QueryWrapper<TDatasetEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<TDatasetEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }


    @Override
    public List<TDatasetEntity> getDatasetName(String type) {

        return tDatasetDao.getDatasetName(type);
    }

}